package com.java.web.manageweb.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.java.manage.pojo.TbItemParamItem;
import com.java.manage.service.TbItemParamItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @ClassName ItemParamItemController
 * @Description 规格参数控制层
 * @Author Trigger Wu
 * @Date 2018/9/1810:07
 * @Version 1.0
 **/
@RequestMapping("item/param/item")
@Controller
public class ItemParamItemController {
    @Autowired
    private TbItemParamItemService itemParamItemService;
    @RequestMapping(value = "{itemId}", method = RequestMethod.GET)
    public ResponseEntity<TbItemParamItem> queryByItemId(@PathVariable("itemId") Long itemId) {
        try {
            TbItemParamItem record = new TbItemParamItem();
            record.setItemId(itemId);

            TbItemParamItem itemParamItem =itemParamItemService.selectById(itemId);
            if (null == itemParamItem) {
                return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
            }
            return ResponseEntity.ok(itemParamItem);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
    }
}
